#pragma once

namespace mphys
{
	class RigidBody;
	typedef uint RigidBodyID; // ble
}

namespace mmath
{
	class Ray;
}


namespace mscene
{
	class Scene;

	class Node
	{
	public:

		Node(Scene & scene, const char * name = NULL);
		Node(const Node & src);
		virtual ~Node();
		virtual Node* copy();

		XMFLOAT3 Position;
		XMFLOAT4 Orientation;
		XMFLOAT3 Scale;
		bool IsStatic;		

		static const int NAME_MAX_SIZE = 16;

		void move(const XMFLOAT3 & vector);
		void rotateXY(float rotX, float rotY);

		virtual void update(float dt);

		void updateRigidBody();

		virtual float rayIntersection(const mmath::Ray & ray);
		virtual void commitEditorChanges();

		void setName(const char * name);
		const char * getName() const;

		void setRigidBody(mphys::RigidBody & rb);
		mphys::RigidBody & getRigidBody();

		bool hasRigidBody() const { return mRigidBody != NULL; }

		char mName[NAME_MAX_SIZE];

		enum NodeType
		{
			BASE, MODEL, MULTIOBJECT
		} Type;

		bool Save;

	protected:
		static int mCurrentDefaultNum;

		Scene & mScene;

		mphys::RigidBodyID mRigidBodyId;
		mphys::RigidBody * mRigidBody;

	private:
		Node & operator=(const Node & src);
	};
}